import request from '@/utils/request'

// 查询样本源 列表
export function listSource(query) {
  return request({
    url: '/biobank/source/list',
    method: 'get',
    params: query
  })
}

// 查询样本源 详细
export function getSource(sourceId) {
  return request({
    url: '/biobank/source/' + sourceId,
    method: 'get'
  })
}

// 根据code查询样本源 详细
export function getSourceByCode(sourceCode) {
  return request({
    url: '/biobank/source/getByCode/' + sourceCode,
    method: 'get'
  })
}

// 根据name查询样本源 详细
export function getSourceByCodeOrName(codeOrName) {
  return request({
    url: '/biobank/source/getByCodeOrName/' + codeOrName,
    method: 'get'
  })
}

// 新增样本源
export function addSource(data) {
  return request({
    url: '/biobank/source',
    method: 'post',
    data: data
  })
}

// 修改样本源
export function updateSource(data) {
  return request({
    url: '/biobank/source',
    method: 'put',
    data: data
  })
}

// 删除样本源
export function delSource(sourceId) {
  return request({
    url: '/biobank/source/' + sourceId,
    method: 'delete'
  })
}

// 导出样本源
export function exportSource(query) {
  return request({
    url: '/biobank/source/export',
    method: 'get',
    params: query
  })
}

// 获取导入样本模板
export function getImportTemplate() {
  return request({
    url: '/biobank/source/importTemplate',
    method: 'get'
  })
}
